<template>
  <div class="zjb_name">
    <!-- 性别页面布局开始 -->
    <div class="zjb_name_head">
      <!-- tou -->
      <p @click="zjb_name_go()">&lt;</p>
      <p>昵称</p>
      <p @click="zjb_name_bao()">保存</p>
      <!-- tou -->
    </div>
    <div class="zjb_name_con">
      <input type="text" v-model="zjb_name_nickname" class="aa"/>
    </div>

    <!-- 性别页面布局结束 -->
  </div>
</template>

<script>
export default {
    name:'Name',
    data(){
        return{
            zjb_name_nickname:''
        }
    },
    mounted(){
        this.zjb_name_nickname=this.$route.query.name;
    },
    methods:{
        zjb_name_go(){//-->点击箭头，返回上一页
            this.$router.go(-1);
        },
       
        zjb_name_bao(){//--->点击保存
            var token=this.$store.state.User.token;
            this.axios.put("https://test.365msmk.com/api/app/user",{
               nickname:this.zjb_name_nickname
            },{
                 headers: {
                        Authorization: "Bearer " + token
                    }
            }).then((ret)=>{
                if(ret.data.code==200){
                    this.$router.go(-1)
                }
            })
        }
    }
}

</script>

<style lang="scss">
.zjb_name {
  width: 100%;
  height: 100%;
  font-size: 0.16rem;
  line-height: 0.2rem;
}
.zjb_name_head {
  height: 0.6rem;
  display: flex;
  align-items: center;
  background: #ccc;
  & > p {
    font-size: 0.25rem;
    margin-left: 0.2rem;
  }
  & > p:nth-child(2) {
    width: 5rem;
    height: auto;
    text-align: center;
    // border: 1px solid #000;
  }
}
input{
    width: 100%;
    height: 1rem;
    font-size: .25rem;
    border:none;
    border-bottom: solid 2px #ccc;
}
</style>